﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using PersonnelManagement.Infrstructre;

namespace PersonnelManagement.Controllers
{
    [Route("api/[controller]")]
    [Authorize]
    [ApiController]
    public class ValuesController : ControllerBase
    {
        public SqlSugerDbcontext db;
        public ValuesController(SqlSugerDbcontext db)
        {
            this.db = db;
        }
        /// <summary>
        /// 初始化数据库
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public string InitDataBase()
        {
            db.CreateDatabase();
            return "ok";
        }


        /// <summary>
        /// 阿波罗配置
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        [Route("Apollo")]
        public IActionResult Apollo([FromServices]IConfiguration configuration,string key)
        {
            var elkCofig = configuration[key];
            return Ok(elkCofig);
        }


    }
}
